<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:template match="/inventory">
		<a href="javascript:void(0);" onclick="onSelectAll();">Select All</a>|<a href="javascript:void(0);" onclick="onSelectNone();">Select None</a>
		<xsl:for-each select="category">
			<h3 class="categoryheading">
				<xsl:value-of select="@title"/>
			</h3>
			<table width="100%" border="1" cellspacing="0" cellpadding="0" class="inventory">
				<thead>
					<tr>
						<th></th>
						<th>ID</th>
						<th>Title</th>
						<th>UPC</th>
						<xsl:for-each select="product[position()=1]/option">
							<th>
								<xsl:value-of select="@title"/>
							</th>
						</xsl:for-each>
						<th>Price</th>
						<th>Discount</th>
						<th></th>
						<th></th>
					</tr>
				</thead>
				<tbody>
					<xsl:for-each select="product">
							<tr>
								<td>
									<input>
										<xsl:attribute name="type">
											<xsl:text>checkbox</xsl:text>
										</xsl:attribute>
										<xsl:attribute name="id">
											<xsl:text>chk</xsl:text>
											<xsl:value-of select="@id"></xsl:value-of>
										</xsl:attribute>
										<xsl:attribute name="value">
											<xsl:value-of select="@id"></xsl:value-of>
										</xsl:attribute>
										<script type="text/javascript">
											regCheckbox('chk<xsl:value-of select="@id"/>');
										</script>
									</input>
								</td>
								<td>
									<xsl:value-of select="@id"/>
								</td>
								<td>
									<xsl:value-of select="@title"/>
								</td>
								<td><xsl:value-of select="@UPC"/></td>
								<xsl:for-each select="option">
									<td>
										<xsl:value-of select="node()"/>
									</td>
								</xsl:for-each>
								<td>
									£<xsl:value-of select="@Price"/>
								</td>
								<td>
									£<xsl:value-of select="@Discount"/>
								</td>
								<td>
									<a>
										<xsl:attribute name="href">
											<xsl:text>AddUpdateProduct.aspx?id=</xsl:text>
											<xsl:value-of select="@id"></xsl:value-of>
										</xsl:attribute>
										Edit
									</a>
								</td>
								<td>
									<a>
										<xsl:attribute name="href">
											<xsl:text>javascript:void(0);</xsl:text>
										</xsl:attribute>
										<xsl:attribute name="onclick">
											<xsl:text>onDelete(</xsl:text>
											<xsl:value-of select="@id"></xsl:value-of>
											<xsl:text>);</xsl:text>
										</xsl:attribute>

										Delete
									</a>
								</td>
							</tr>
					</xsl:for-each>
				</tbody>
			</table>
		</xsl:for-each>
	</xsl:template>

</xsl:stylesheet>

